package com.zhou.code;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

public class CodeFactoryDbSource extends CodeFactory{

    private Properties properties;

    CodeFactoryDbSource() throws IOException {
        Properties properties = new Properties();
        try (FileInputStream in = new FileInputStream(Constant.PROPERTIES_FILE)) {
            properties.load(in);
        }
        this.properties = properties;
    }

    protected CodeFactoryDbSource(Properties properties) {
        this.properties = properties;
    }

    @Override
    Reader getReader() throws Exception {
        return new DataReader(this.properties);
    }

    @Override
    String getTargetFileDir() {
        return "db/";
    }

}